﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using EFDataModel;
using GlobalResources;
using Resources;

namespace ContactManagement.Models
{
    public class UserAddModel : EditUserAdminModel
    {
        #region Properties
        /// <summary>
        /// Benutzername (Email), hier direkt per Attribut prüfen ob der Username bereits vergeben ist.
        /// </summary>
        [Display(Name = "LoginnameRESX", ResourceType = typeof(AccountViews))]
        [Required]
        [RegularExpression(WebConstants.EmailRegularExpString, ErrorMessageResourceName = "InvalidEMailAddressRESX", ErrorMessageResourceType = typeof(SystemMessages))]
        [Remote("ValidateUserName", "Account", ErrorMessageResourceName = "UserExistsErrorRESX", ErrorMessageResourceType = typeof(SystemMessages))]
        public new string UserName { get; set; }
        #endregion

        #region Kosntruktor
        public UserAddModel()
            : base()
        {
        }

        public UserAddModel(EFUser efUser)
            : base(efUser)
        {
            UserName = efUser.LoginEmail;
        }
        #endregion
    }
}